home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-30 | 11.8 KB | 398 lines | [TEXT/MPS ] |
- //
- // powerMac.r
- //
- // This example demonstrates usage of the Easy and Custom Install frameworks
- // to create a customized installation depending on whether the target machine
- // is a Power Macintosh or a 68000 CPU machine.
- //
- // All files are installed to folder "PowerMac Rules Example:" on root folder
- // of selected target volume for the installation.
- //
- // NOTE: This example uses Gestalt calls to determine the CPU of the target
- // machine of the installation. Some machines with STP cards in them are
- // actually both PowerMac and 68K, but via a Control Panel the user can select
- // which machine they want their Mac to behave as. This example script will
- // install the appropriate modules during Easy Install for whichever CPU the
- // target machine is currently set up as. Because of the STP upgrade card
- // situation, most scriptwriters will actually want to include all possible
- // installation scenarios under Custom Install.
- //
- // Copyright 1993-1996, Apple Computer, Inc., All Rights Reserved
- //
-
-
- #include "InstallerTypes.r"
-
-
- // constants for Gestalt call to determine whether PowerMac or 68K CPU
- #define gestaltSystemType 'sysa' // tells Gestalt to check CPU
- #define gestalt68Ksysa 1 // tells Gestalt to look for 68K CPU's
- #define gestaltPPCsysa 2 // tells Gestalt to look for PowerMac CPU's
-
- // constants for packages, comments, comment text
- #define kPowerMacPackage 100
- #define k68000Package 200
- #define kSeperatorLine 9999
-
-
- // • easy install setup
-
- // easy install framework uses ID other than 765 or 766
- // recommended to always use ID 764
- resource 'infr' (764) {
- format0 {{
- // execute first true rule, if none are true then return false
- pickFirst, { 700, 800 }, // check CPU version, if PowerMac then
- // install PowerMac, otherwise install
- // 68K version
- }}
- };
-
- // rule that adds Power Macintosh version file to Easy Install
- resource 'inrl' (700) {
- format0 {{
- // this returns false unless CPU is Power Macintosh
- CheckGestalt{ gestaltSystemType, { gestaltPPCsysa }},
-
- // if Power Macintosh CPU add that package
- AddPackages{{ kPowerMacPackage }},
- AddUserDescription{ "Install the PowerMac Example File to \"PowerMac Rules Example\" folder." },
- }}
- };
-
- // rule that adds 68K version file to Easy Install
- resource 'inrl' (800) {
- format0 {{
-
- // if not a PowerMac, add the 68000 CPU package
- AddPackages{{ k68000Package }},
- AddUserDescription{ "Install the 68K Example File to \"PowerMac Rules Example\" folder." },
- }}
- };
-
-
- // • custom install setup
-
- // custom install framework always uses ID of 766
- resource 'infr' (766) {
- format0 {{
- pickAll, { 1000 }, // give choices of PowerMac and 68K
- }}
- };
-
- // rule that adds both PowerMac and 68K packages
- resource 'inrl' (1000) {
- format0 {{
-
- // add both PowerMac and 68K packages to Custom Install selections
- AddCustomItems{{ kPowerMacPackage, kSeperatorLine, k68000Package }},
- }}
- };
-
-
- // • packages
-
- // Power Macintosh
- resource 'inpk' ( kPowerMacPackage ) {
- format0 {
- showsOnCustom, // if a subpackage, show in Custom Install
- removable, // include as a removeable item
- dontForceRestart, // don't make user reboot after installation
- kPowerMacPackage, // ID of package comments ( 'inpc' ), defined below
- 0, // Package size ( if 0, filled in by ScriptCheck )
-
- "PowerMac - Example File to \"PowerMac Rules Example\" folder.",
- // Custom Install selection text
-
-
- { // Package parts list ( all the stuff to be include in package )
- // These parts can be 'inpk', 'infa', 'inra', 'inr#', 'inrm',
- // 'inff', 'infm', 'inaa', 'inat', 'inat', or 'inbb'
-
- 'infa', 1075; // PowerMac file
- },
- }
- };
-
-
- // seperator line in Custom Install list of options
- resource 'inpk' ( kSeperatorLine ) {
- format0 {
- showsOnCustom, // if a subpackage, show in Custom Install
-
- notRemovable, // don't allow selection of seperator line
- // for removal
-
- dontForceRestart, // don't make user reboot after installation
- 0, // no comments for a seperator line
- 0, // no size for a seperator line
- "-", // display a dashed line in Custom Install
- {
- // parts list is empty for seperator line
- },
- }
- };
-
- // 68K
- resource 'inpk' ( k68000Package ) {
- format0 {
- showsOnCustom, // if a subpackage, show in Custom Install
- removable, // include as a removeable item
- dontForceRestart, // don't make user reboot after installation
- k68000Package, // ID of package comments ( 'inpc' ), defined below
- 0, // Package size ( if 0, filled in by ScriptCheck )
-
- "68K - Example File to \"PowerMac Rules Example\" folder.",
- // Custom Install selection text
-
-
- { // Package parts list ( all the stuff to be include in package )
- // These parts can be 'inpk', 'infa', 'inra', 'inr#', 'inrm',
- // 'inff', 'infm', 'inaa', 'inat', 'inat', or 'inbb'
-
- 'infa', 1070; // 68K compatable file
- },
- }
- };
-
-
-
- // • package comments
-
- // NOTE: The file that will be installed in either package is an Example File.
- // The information detailed below does not actually correspond to
- // the file being installed and is intended only as an example of how to prepare
- // custom package information resources.
-
- // FURTHER NOTE: The values that are assigned to the Custom Package Information
- // resource fields do not actually have any effect on the installation and are
- // ignored during installation. They can however assist the user in choosing which
- // packages they would like to include in their Custom Installation or Custom Removal.
-
- // The following included file contains the icons for the two package comments.
- // The file with the icon resources ( in this case 'icl4' and 'icl8' ) was created
- // by opening the owner application of the file to be installed (in this case,
- // SimpleText) within ResEdit. The 'ICN#', 'icl4' and'icl8' icon resources were then
- // copied into a new ResEdit file called "Icons.rsrc" and assigned the resource items
- // an ID of 9128, since their original resource ID's had a value that was illegal
- // for use with 'inpc' resources ( they must be over 1024 ).
- // - An alternative to this method is to derez the application and to paste the
- // resulting resource definitions into this script file and to let the Rez command
- // build the icons every time that the installer script is Rezzed. If you happen
- // to forget to include the resources for the icons, ScriptCheck will complain,
- // but you will still be able to use the Rezzed installer script to successfully
- // perform an installation.
- include "Icons.rsrc";
-
- resource 'inpc' ( kPowerMacPackage ) {
- format1 {
- 8021994, // sample date ( 08/02/94 )
- 403, // sample version ( 4.0.3 )
-
- 2500 * 1024, // RAM required for package ( 2.5 megabytes )
-
- 9128, // icon rsrc ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item in rezzed script file
-
- kPowerMacPackage, // 'TEXT' resource ID of item
- // containing package description
-
- }
- };
-
- resource 'inpc' ( k68000Package ) {
- format1 {
- 8021994, // sample date ( 08/02/94 )
- 403, // sample version ( 4.0.3 )
-
- 4250 * 1024, // RAM required for package ( 4.25 megabytes )
-
- 9128, // icon rsrc ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item in rezzed script file
-
- k68000Package, // 'TEXT' resource ID of item
- // containing package description
- }
- };
-
-
- // The following resource items can easily be created manually by creating 'TEXT'
- // resource items in a file and including that file in this script.
- // USE: include "<fileWithTextItem>.rsrc";
- // NOTE : resource includes use "include" instead of "#include"
- // and are terminated with a semicolon.
- data 'TEXT' ( kPowerMacPackage ) {
- "This is some sample text that would describe what the Power Macintosh "
- "package contains."
- };
-
- data 'TEXT' ( k68000Package ) {
- "This is some sample text that would describe what the 68000 CPU "
- "package contains."
- };
-
-
-
- // • file atoms
-
- // file atom for PowerMac version
- resource 'infa' (1075) {
- format1 {
- deleteWhenRemoving,
- deleteWhenInstalling,
- copy,
- dontIgnoreLockedFile,
- dontSetFileLocked,
- useSrcCrDateToCompare,
- srcNeedExist,
- rsrcForkInRsrcFork,
- leaveAloneIfNewer,
- updateExisting,
- copyIfNewOrUpdate,
- rsrcFork,
- dataFork,
- 0,
- 0x0,
- 10075,
- {
- 10076,
- 0,
- 0
- },
- 0,
- 0,
- 0,
- "Example File • PowerMac"
- }
- };
-
- // file atom for 68K version
- resource 'infa' (1070) {
- format1 {
- deleteWhenRemoving,
- deleteWhenInstalling,
- copy,
- dontIgnoreLockedFile,
- dontSetFileLocked,
- useSrcCrDateToCompare,
- srcNeedExist,
- rsrcForkInRsrcFork,
- leaveAloneIfNewer,
- updateExisting,
- copyIfNewOrUpdate,
- rsrcFork,
- dataFork,
- 0,
- 0x0,
- 10070,
- {
- 10071,
- 0,
- 0
- },
- 0,
- 0,
- 0,
- "Example File • 68K"
- }
- };
-
-
- // • file specs
-
- // target file spec for Example File • PowerMac File
- resource 'intf' (10075) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'ttro', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- ":PowerMac Rules Example:Example File • PowerMac" // path to target file
- }
- };
-
-
- // source file spec for Example File • PowerMac
- resource 'infs' (10076) {
- 'ttro', // TYPE for file search
- 'ttxt', // CREATOR for file search
-
- 0x1, // creation DATE for source file
- // ( value of 1, filled in by ScriptCheck
-
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:Example File • PowerMac" // PATH to source file
- };
-
-
- // target file spec for Example File • 68K
- resource 'intf' (10070) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'ttro', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- ":PowerMac Rules Example:Example File • 68K" // path to target file
- }
- };
-
- // source file spec for Example File • 68K
- resource 'infs' (10071) {
- 'ttro', // TYPE for file search
- 'ttxt', // CREATOR for file search
-
- 0x1, // creation DATE for source file
- // ( value of 1, filled in by ScriptCheck
-
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:Example File • 68K" // PATH to source file
- };
-
-
-